package com.xinfu.newproject.adapter.my_community;

import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.bean.home.bean.GetAppIconBean;

/**
 *
 */
public class MyCommunityAdapter extends BaseQuickAdapter<GetAppIconBean.ResultBean.CommunityMenuBean, BaseViewHolder> {

    private LinearLayout linearLayout;
    private ImageView itemImageView;
    private TextView itemTextview;

    public MyCommunityAdapter() {
        super(R.layout.item_home_adapter, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, GetAppIconBean.ResultBean.CommunityMenuBean item) {

        itemTextview = helper.getView(R.id.item_home_adapter_tv);
        itemImageView = helper.getView(R.id.item_home_adapter_iv);
        linearLayout = helper.getView(R.id.item_home_adapter_ll);

        itemTextview.setText(item.getName());
        Glide.with(mContext).load(item.getIcon()).into(itemImageView);
//        linearLayout.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                switch (position) {
//                    case 0:
//                        if (isLogin()) {
//                            ((HomeActivity) context).startIntentActivity(WaterRefillActivity.class, null);
//                        } else {
//                            ((HomeActivity) context).startIntentActivity(LoginActivity.class, null);
//                        }
//                        break;
//                    case 1:
//                        if (isLogin()) {
//                            ((HomeActivity) context).startIntentActivity(ElectricityRefillActivity.class, null);
//                        } else {
//                            ((HomeActivity) context).startIntentActivity(LoginActivity.class, null);
//                        }
//                        break;
//                    case 2:
//                        if (isLogin()) {
//                            ((HomeActivity) context).startIntentActivity(VisitorInvitationActivity.class, null);
//                        } else {
//                            ((HomeActivity) context).startIntentActivity(LoginActivity.class, null);
//                        }
//                        break;
//                    case 3:
//                        if (isLogin()) {
//                            Toast.makeText(context, "暂不支持该功能", Toast.LENGTH_SHORT).show();
//                        } else {
//                            ((HomeActivity) context).startIntentActivity(LoginActivity.class, null);
//                        }
//                        break;
//                }
//            }
//        });

    }

}
